#pragma once
#include "statemanager\GameStateManager.h"
#include <string>
#include "Grid.h"
#include "addons\SpriteCounter.h"
#include "HUD.h"
#include "console\GameConsole.h"
#include "EventManager.h"
#include <base\Controller.h>
#include <addons\MenuComponent.h>
#include "GameCore.h"


class RunState : public ds::GameState , public ds::EventHandler , public ds::KeyboardController {

enum GameMode {
	INTRO,
	MENU,
	PLAYING,
	GAME_OVER,
	CREDITS,
	PAUSE,
	TEST
};

public:
	RunState(std::string name,GameCore* core);
	~RunState(void) {}
	bool init() {
		return true;
	}
    bool update(float elapsedTime);
    bool onActivation();
    bool onDeactivation();		
	//
	void process(ds::EventBuffer& buffer );
	// keyboard
	void OnKeyUp( WPARAM virtualKeyCode ) {}
	void OnKeyDown( WPARAM virtualKeyCode ) {}
	void OnChar( char ascii,unsigned int keyState ) {
		if ( ascii == 'd' ) {
			gEngine->debug();
		}
		if ( ascii == 'e' ) {
			switchState(GAME_OVER);
		}
	}
private:	
	void switchState(GameMode state);	
	bool running;	
	GameCore* m_Core;
	GameMode m_State;
};

